package com.hamizhong.iflowers.web.action.admin.statics;

import net.sf.json.JSONObject;

import com.hamizhong.iflowers.service.IFlowerFloridService;
import com.hamizhong.iflowers.utils.MyConstants;
import com.hamizhong.iflowers.web.base.MyBaseAjaxAction;
import com.hamizhong.iflowers.web.dto.IOPResultDto;
import com.hamizhong.iflowers.web.vo.FlowerFloridVO;
import com.hamizhong.iflowers.web.vo.IObjectVO;

public class AjaxUpdateFlowerFloridAction extends MyBaseAjaxAction {
	
	private IFlowerFloridService iFlowerFloridService = null;
	
	public IFlowerFloridService getiFlowerFloridService() {
		return iFlowerFloridService;
	}
	public void setiFlowerFloridService(IFlowerFloridService iFlowerFloridService) {
		this.iFlowerFloridService = iFlowerFloridService;
	}
	
	@Override
	protected JSONObject doRequest() {
		logger.info("...invoke...AjaxUpdateFlowerFloridAction...");
		String flowerFloridName = getRQ().getParameter("flowerFloridName");
		String flowerFloridId = getRQ().getParameter("flowerFloridId");
		String sortId = getRQ().getParameter("sortId");
		String remarks = getRQ().getParameter("remarks");
		IOPResultDto<IObjectVO> resultDto = new IOPResultDto<IObjectVO>();
		FlowerFloridVO flowerFloridVO = new FlowerFloridVO();
		flowerFloridVO.setFlowerFloridName(flowerFloridName);
		flowerFloridVO.setFlowerFloridId(Integer.valueOf(flowerFloridId));
		flowerFloridVO.setSortId(Integer.valueOf(sortId));
		flowerFloridVO.setRemarks(remarks);
		resultDto = iFlowerFloridService.updateFlowerFlorid(flowerFloridVO);
		JSONObject jo = new JSONObject();
		if(resultDto.isSuccess()) {
			jo.put("result", MyConstants.AJAX_SUCCESS);
		}else {
			jo.put("result", MyConstants.AJAX_FAILED_ALERT);
			jo.put("msg", resultDto.getErrorMSG());
		}
		return jo;
	}

}
